<template>
	<view class="home">
		<!--资料详情-->
		<view class="zl_down" style="margin-top: 10px;">

			<view class="zl_c" @click="get_team_nub()">
				<view class="iconfont icon-renzheng-" style="margin-top: 8px; margin-left: 3px;font-size:20px;color: #F14399;"></view>
					<view class="zl_c_d"><text style="font-size: 14px;color: #4D4D4D;">团队人数<text style="color: red;">{{nub}}</text>人</text></view>
					<view class="zl_c_e">
					  <view class="iconfont icon-jinrujiantou"></view>
					</view>
			</view>
			
			<view class="zl_c" @click="cashout_lsit()">
				<view class="iconfont icon-nvxing" style="margin-top: 8px; margin-left: 3px;font-size:20px;color: #F14399;"></view>
					<view class="zl_c_d"><text style="font-size: 14px;color: #4D4D4D;">提现列表</text></view>
					<view class="zl_c_e">
					  <view class="iconfont icon-jinrujiantou"></view>
					</view>
			</view>
			
			<view class="zl_c" @click="cashout()">
				<view class="iconfont icon-pipei" style="margin-top: 8px; margin-left: 3px;font-size:20px;color: #F14399;"></view>
					<view class="zl_c_d"><text style="font-size: 14px;color: #4D4D4D;">提现</text></view>
					<view class="zl_c_e">
					  <view class="iconfont icon-jinrujiantou"></view>
					</view>
			</view>
			
			<view class="zl_c" @click="p_income()">
				<view class="iconfont icon-kefu" style="margin-top: 8px; margin-left: 3px;font-size:20px;color: #F14399;"></view>
					<view class="zl_c_d"><text style="font-size: 14px;color: #4D4D4D;">收入明细</text></view>
					<view class="zl_c_e">
					  <view class="iconfont icon-jinrujiantou"></view>
					</view>
			</view>
			
		</view>
		
	</view>
</template>


<script>
	import helper from '.../../common/helper.js';  
	export default {
		data() {
			return {
				seen: false,
				products:{},
				nub:0,
			}
		},
		onLoad(options) {

		       //获取URL
			   let url = location.href;
			   //声明参数字典
			   let requestDic = {};
			   //确定URL中包含 ？ 
			   if (url.indexOf("?") !== -1){
				   //返回 ？ 后面的字符串
				   let str = url.substr(url.indexOf("?") + 1);
				   //通过 & 符号分割字符串，获取参数数组
				   let strArray = str.split("&");
				   //遍历参数数组
				   for (let i = 0; i < strArray.length; i++){
					   //把遍历到的每一个元素再以 = 分割，分割后第0为作为key，第一位作为value 存放到字典中
					   requestDic[strArray[i].split("=")[0]] = decodeURI(strArray[i].split("=")[1]);
				   }
			   }

			   if(!requestDic.id || 0 === requestDic.id.length){
					this.seen=false;
			   }else{
				   this.id=requestDic.id
			   }
			   
			   this.getinfo();//检查缓存
			   
			//    this.get_team_nub();//获取人数
			   
		},
	
		methods: {
			
			//检测是否登录
			checkGuide(url){
				const launchFlag = uni.getStorageSync('my_ziliao');
				// console.log(launchFlag)

				if(!launchFlag.data.id || 0 === launchFlag.data.id.length){
		
					uni.showToast({
						title: '请先登录',
						duration: 2000,
						icon: 'none'
					})
				}else{
					uni.navigateTo({
					    url:url+"?id="+launchFlag.id
					});	
				}
			},
			//登录
			denglu(){
                //判断是不否是微信浏览器登录
				let status = navigator.userAgent.toLowerCase();
				if (status.match(/MicroMessenger/i) == "micromessenger") {
					window.location.href ="http://ds.kzjpht.com/index/Jsapi/index";
				}else{
					uni.navigateTo({
					    url: '/pages/login/login'
					});
				}
			},
			
            //查看是否有缓存
			async getinfo(){
				const launchFlag = uni.getStorageSync('my_ziliao');

				const res= await this.$myRuquest({
					url: '/index/dsnv.activities/myinfo2?id='+this.id
				})
			    uni.setStorageSync('my_ziliao',res.data);
				var my_ziliao=uni.getStorageSync('my_ziliao');
				this.id=my_ziliao.id;

				if(!my_ziliao.id || 0 === my_ziliao.length){
					this.seen=false;
				}else{
					this.seen=true;
					this.products=my_ziliao
				}
			},
			async get_team_nub(){
				const res = await this.$myRuquest({
					url: '/index/api/get_team_nub?id='+this.id
				})
				this.nub=res.data.nub;
			},	
			//提现
			cashout(){
				this.checkGuide('/pages/my/tools/cashout');//检查是否登录
			},	
			//提现列现
			cashout_lsit(){
				this.checkGuide('/pages/my/tools/cashout_lsit');//检查是否登录
				
				uni.switchTab({
					url: "/pagesA/my/tools/cashout_lsit"
				})
			},
			//收入明细
			p_income(){
				this.checkGuide('/pages/my/tools/p_income');//检查是否登录
			},
			
			
		}
	}
</script>

<style lang="scss">

	.home{
		height: 850px;
		background-color: #F6F6F6;

		//头像
		.header{
			background-color: #fff;
		     margin: 0 10px;
			  display: flex;
			  height: 100px;
			margin-bottom: 10px;
			border-radius: 10px;
			  .header_left{
				  image{
					  margin-left: 10px;
					  margin-top: 10px;
					  width: 80px;
					  height: 80px;
					  border-radius: 50%;
				  }
			  }
			  .header_right{
				  width: 60%;
				  margin-left: 5%;
				  margin-top: 20px;
			  }
			  .header_rt{
				  margin-left: 5%;
				  margin-top: 45px;
			  }
			  
		  
		}
		.middle{
			background-color: #fff;
			margin: 0 10px;
			display: flex;
			height: 90px;
			border-radius: 10px;
			text-align: center;
			.middle_c{
				margin-top: 10px;
				width: 33%;
			}
			
		}
		.zl_down{
			background-color: #fff;
			margin: 0 10px;
			height: 380px;
			border-radius: 10px;
			.zl_c{
				display: flex;
				padding-left: 20px;
				padding-top: 20px;
				.zl_c_d{
					margin-top: 6px;
					margin-left: 5px;
					width: 100%;
				}
				.zl_c_e{
					padding-right: 20px;
					margin-top: 8px;
				}
			}
	
		}

}
</style>
